import { _decorator, Component, Node, Collider2D, Animation, Contact2DType, IPhysics2DContact } from 'cc'
import { GameManage } from './GameManage'
const { ccclass, property } = _decorator

@ccclass('CheckLine')
export class CheckLine extends Component {
  /* animation: Animation = null
  start() {
    this.animation = this.node.getComponent(Animation)

    const collider: Collider2D = this.node.getComponent(Collider2D) // 获取碰撞器组件
    // 监听开始碰撞
    collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this) // 只在两个碰撞体开始接触时被调用一次
    collider.on(Contact2DType.END_CONTACT, this.onEndContact, this) // 只在两个碰撞体结束接触时被调用一次
  }
  onBeginContact(selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
    const [idleClip] = this.animation.clips
    if (!this.animation.getState(idleClip.name).isPlaying) this.animation.play()
  }
  onEndContact(selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
    this.animation.stop()
  } */
}
